<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>电梯品牌维护</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
	<script type="text/javascript" src="../../js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="../../js/dialog/jquery.artDialog.source.js?skin=default"></script>
	<script type="text/javascript" src="../../js/dialog/plugins/iframeTools.source.js"></script>
	<script type="text/javascript" src="../../js/jquery.form.js"></script>
	<script type="text/javascript" src="../../js/jquery.page.js"></script>
	<script type="text/javascript" src="../../js/base.js"></script>
</head>
<body class="app">
	<h3>电梯品牌维护</h3>
	<form class="search" name="search">
		<div class="tbdiv">
		<table>
			<tr>
				<th>品牌编号：</th>
				<td><input type="text" class="inputText" name="eleTradeCode" value="" style="width:110px;"/></td>
				<th>品牌名称：</th>
				<td><input type="text" class="inputText" name="eleTradeName" value="" style="width:110px;"/></td>
				<td align="right"><input type="submit" value="查询" class="inputButton"/></td>
			</tr>
		</table>
		</div>
	</form>
	<div id="list"></div>
	<div class="optionlink">
		<span id="btnAdd">【添加品牌】</span>
		<span id="btnDel">【删除所选】</span>
	</div>
	
	<div id="view" style="width:350px;display:none;">
		<form name="saveFrom" action="dtppwh_save.action" method="post">
		<input type="hidden" name="eleTradeId" />
		<dl class="view" style="margin-top:5px;">
			<dt>电梯品牌编号：</dt>
			<dd class="giant" id="lh_eleTradeCode">
				<input type="text" class="inputText" name="eleTradeCode" style="width:98%" ver="empty" msg="请填写电梯品牌编号"/>
			</dd>
			<dt>电梯品牌名称：</dt>
			<dd class="giant">
				<input type="text" class="inputText" name="eleTradeName" style="width:98%" ver="empty" msg="请填写电梯品牌名称"/>
			</dd>
			<div class="cl"></div>
		</dl>
		</form>
	</div>
	
	<script type="text/javascript">
	$(function(){
		$(document.search).ajaxForm({
			beforeSubmit:function(formData){
				var param = $(formData).formParam();
				$('#list').page('param',param);
				$('#list').page('show');
				return false;
			}
		});
		$(document.saveFrom).ajaxForm({
			beforeSubmit:function(form){
				var ver = $(document.saveFrom).validator();
				if(!ver.reg) $.dialog.alert(ver.msg);
				return ver.reg;
			},
			success:function(response){
				var param = $(document.search).formParam();
				$('#list').page('param',param);
				$('#list').page('show');
				$.dialog.list['viewdialog'].close();
			}
		});
		//分页列表
		$('#list').page({
			url:'dtppwh_search.action',
			config:'pageinfo,record,first,last,next,prev,jump',
			items:[{
				name:'eleTradeId',
				type:'checkbox',
				width:13
			},{
				title:'电梯品牌编号',
				name:'eleTradeCode'
			},{
				title:'电梯品牌名称',
				name:'eleTradeName'
			},{
				title:'详情',
				render:function(row){
					$a = $('<a href="javascript:void(0)")">【详细】</a>');
					$a.click(function(){
						view(row);
					});
					return $a;
				}
			}]
		});
		$('#btnAdd').click(function(){
			view(null);
		});
		$('#btnDel').click(function(){
			$.dialog.confirm('您确认删除所选电梯吗？',function(){
				var ids = $('#list').data('checked').join(',');
				$.post('dtppwh_del.action',{ids:ids},function(response){
					$('#list').page('show',1);
				});
			});
		});
	});

	var view = function(row){
		$(document.saveFrom).resetForm();
		$(document.saveFrom.eleTradeId).val('');
		var d = $.dialog({
			id:'viewdialog',
			title:'电梯品牌维护',
			lock:true,
			padding:'5px 8px 5px 5px',
			width:'100%',
			height:'100%',
			content:document.getElementById('view'),
			button:[{
				name:'保存',
				focus:true,
				callback:function(){
					$(document.saveFrom).submit();
					return false;
				}
			}]
		});
		if(row!=null){
			$('#lh_eleTradeCode').html('<label name="eleTradeCode"></label>');
		}else{
			$('#lh_eleTradeCode').html('<input type="text" class="inputText" name="eleTradeCode" style="width:98%" ver="empty" msg="请填写电梯品牌编号"/>');
		}
		$(document.saveFrom).json2form(row);
	}
	</script>
</body>
</html>
